package kevin.workplan.database.gen.mapper;

import java.util.List;
import kevin.workplan.database.gen.model.Projects;
import kevin.workplan.database.gen.model.ProjectsExample;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.DeleteProvider;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.InsertProvider;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.SelectProvider;
import org.apache.ibatis.annotations.Update;
import org.apache.ibatis.annotations.UpdateProvider;
import org.apache.ibatis.type.JdbcType;

public interface ProjectsMapper {
    @SelectProvider(type=ProjectsSqlProvider.class, method="countByExample")
    int countByExample(ProjectsExample example);

    @DeleteProvider(type=ProjectsSqlProvider.class, method="deleteByExample")
    int deleteByExample(ProjectsExample example);

    @Delete({
        "delete from projects",
        "where id = #{id,jdbcType=BIGINT}"
    })
    int deleteByPrimaryKey(Long id);

    @Insert({
        "insert into projects (id, pid, uid, ",
        "name, type, sort)",
        "values (#{id,jdbcType=BIGINT}, #{pid,jdbcType=BIGINT}, #{uid,jdbcType=BIGINT}, ",
        "#{name,jdbcType=VARCHAR}, #{type,jdbcType=INTEGER}, #{sort,jdbcType=INTEGER})"
    })
    int insert(Projects record);

    @InsertProvider(type=ProjectsSqlProvider.class, method="insertSelective")
    int insertSelective(Projects record);

    @SelectProvider(type=ProjectsSqlProvider.class, method="selectByExample")
    @Results({
        @Result(column="id", property="id", jdbcType=JdbcType.BIGINT, id=true),
        @Result(column="pid", property="pid", jdbcType=JdbcType.BIGINT),
        @Result(column="uid", property="uid", jdbcType=JdbcType.BIGINT),
        @Result(column="name", property="name", jdbcType=JdbcType.VARCHAR),
        @Result(column="type", property="type", jdbcType=JdbcType.INTEGER),
        @Result(column="sort", property="sort", jdbcType=JdbcType.INTEGER)
    })
    List<Projects> selectByExample(ProjectsExample example);

    @Select({
        "select",
        "id, pid, uid, name, type, sort",
        "from projects",
        "where id = #{id,jdbcType=BIGINT}"
    })
    @Results({
        @Result(column="id", property="id", jdbcType=JdbcType.BIGINT, id=true),
        @Result(column="pid", property="pid", jdbcType=JdbcType.BIGINT),
        @Result(column="uid", property="uid", jdbcType=JdbcType.BIGINT),
        @Result(column="name", property="name", jdbcType=JdbcType.VARCHAR),
        @Result(column="type", property="type", jdbcType=JdbcType.INTEGER),
        @Result(column="sort", property="sort", jdbcType=JdbcType.INTEGER)
    })
    Projects selectByPrimaryKey(Long id);

    @UpdateProvider(type=ProjectsSqlProvider.class, method="updateByExampleSelective")
    int updateByExampleSelective(@Param("record") Projects record, @Param("example") ProjectsExample example);

    @UpdateProvider(type=ProjectsSqlProvider.class, method="updateByExample")
    int updateByExample(@Param("record") Projects record, @Param("example") ProjectsExample example);

    @UpdateProvider(type=ProjectsSqlProvider.class, method="updateByPrimaryKeySelective")
    int updateByPrimaryKeySelective(Projects record);

    @Update({
        "update projects",
        "set pid = #{pid,jdbcType=BIGINT},",
          "uid = #{uid,jdbcType=BIGINT},",
          "name = #{name,jdbcType=VARCHAR},",
          "type = #{type,jdbcType=INTEGER},",
          "sort = #{sort,jdbcType=INTEGER}",
        "where id = #{id,jdbcType=BIGINT}"
    })
    int updateByPrimaryKey(Projects record);
}